home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / Events.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  10.2 KB  |  385 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 8
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  19. __EVENTS__ SET 1
  20.  
  21.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  22.     include 'OSUtils.a'
  23.     ENDIF
  24.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  25.     include 'Quickdraw.a'
  26.     ENDIF
  27.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  28.     include 'Types.a'
  29.     ENDIF
  30.  
  31. ; typedef UInt16                         EventKind
  32.  
  33. ; typedef UInt16                         EventMask
  34.  
  35.  
  36. nullEvent                        EQU        0
  37. mouseDown                        EQU        1
  38. mouseUp                            EQU        2
  39. keyDown                            EQU        3
  40. keyUp                            EQU        4
  41. autoKey                            EQU        5
  42. updateEvt                        EQU        6
  43. diskEvt                            EQU        7
  44. activateEvt                        EQU        8
  45. osEvt                            EQU        15
  46. kHighLevelEvent                    EQU        23
  47.  
  48. mDownMask                        EQU        $02                    ; mouse button pressed
  49. mUpMask                            EQU        $04                    ; mouse button released
  50. keyDownMask                        EQU        $08                    ; key pressed
  51. keyUpMask                        EQU        $10                    ; key released
  52. autoKeyMask                        EQU        $20                    ; key repeatedly held down
  53. updateMask                        EQU        $40                    ; window needs updating
  54. diskMask                        EQU        $80                    ; disk inserted
  55. activMask                        EQU        $0100                ; activate/deactivate window
  56. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents)
  57. osMask                            EQU        $8000                ; operating system events (suspend, resume)
  58. everyEvent                        EQU        $FFFF                ; all of the above
  59.  
  60. charCodeMask                    EQU        $000000FF
  61. keyCodeMask                        EQU        $0000FF00
  62. adbAddrMask                        EQU        $00FF0000
  63. osEvtMessageMask                EQU        $FF000000
  64.  
  65.                                                             ; OS event messages.  Event (sub)code is in the high byte of the message field.
  66. mouseMovedMessage                EQU        $00FA
  67. suspendResumeMessage            EQU        $0001
  68.  
  69. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend
  70. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change
  71.  
  72. ; typedef UInt16                         EventModifiers
  73.  
  74.  
  75.                                                             ; modifiers 
  76. activeFlagBit                    EQU        0                    ; activate? (activateEvt and mouseDown)
  77. btnStateBit                        EQU        7                    ; state of button?
  78. cmdKeyBit                        EQU        8                    ; command key down?
  79. shiftKeyBit                        EQU        9                    ; shift key down?
  80. alphaLockBit                    EQU        10                    ; alpha lock down?
  81. optionKeyBit                    EQU        11                    ; option key down?
  82. controlKeyBit                    EQU        12                    ; control key down?
  83. rightShiftKeyBit                EQU        13                    ; right shift key down?
  84. rightOptionKeyBit                EQU        14                    ; right Option key down?
  85. rightControlKeyBit                EQU        15                    ; right Control key down?
  86.  
  87. activeFlag                        EQU        $01
  88. btnState                        EQU        $80
  89. cmdKey                            EQU        $0100
  90. shiftKey                        EQU        $0200
  91. alphaLock                        EQU        $0400
  92. optionKey                        EQU        $0800
  93. controlKey                        EQU        $1000
  94. rightShiftKey                    EQU        $2000
  95. rightOptionKey                    EQU        $4000
  96. rightControlKey                    EQU        $8000
  97.  
  98. kNullCharCode                    EQU        0
  99. kHomeCharCode                    EQU        1
  100. kEnterCharCode                    EQU        3
  101. kEndCharCode                    EQU        4
  102. kHelpCharCode                    EQU        5
  103. kBellCharCode                    EQU        7
  104. kBackspaceCharCode                EQU        8
  105. kTabCharCode                    EQU        9
  106. kLineFeedCharCode                EQU        10
  107. kVerticalTabCharCode            EQU        11
  108. kPageUpCharCode                    EQU        11
  109. kFormFeedCharCode                EQU        12
  110. kPageDownCharCode                EQU        12
  111. kReturnCharCode                    EQU        13
  112. kFunctionKeyCharCode            EQU        16
  113. kEscapeCharCode                    EQU        27
  114. kClearCharCode                    EQU        27
  115. kLeftArrowCharCode                EQU        28
  116. kRightArrowCharCode                EQU        29
  117. kUpArrowCharCode                EQU        30
  118. kDownArrowCharCode                EQU        31
  119. kDeleteCharCode                    EQU        127
  120. kNonBreakingSpaceCharCode        EQU        202
  121. EventRecord                RECORD 0
  122. what                     ds.w    1                ; offset: $0 (0)
  123. message                     ds.l    1                ; offset: $2 (2)
  124. when                     ds.l    1                ; offset: $6 (6)
  125. where                     ds        Point            ; offset: $A (10)
  126. modifiers                 ds.w    1                ; offset: $E (14)
  127. sizeof                     EQU *                    ; size:   $10 (16)
  128.                         ENDR
  129.  
  130. ;
  131. ; pascal void GetMouse(Point *mouseLoc)
  132. ;
  133.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  134.         _GetMouse:    OPWORD    $A972
  135.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  136.         IMPORT_CFM_FUNCTION GetMouse
  137.     ENDIF
  138.  
  139. ;
  140. ; pascal Boolean Button(void )
  141. ;
  142.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  143.         _Button:    OPWORD    $A974
  144.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  145.         IMPORT_CFM_FUNCTION Button
  146.     ENDIF
  147.  
  148. ;
  149. ; pascal Boolean StillDown(void )
  150. ;
  151.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  152.         _StillDown:    OPWORD    $A973
  153.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  154.         IMPORT_CFM_FUNCTION StillDown
  155.     ENDIF
  156.  
  157. ;
  158. ; pascal Boolean WaitMouseUp(void )
  159. ;
  160.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  161.         _WaitMouseUp:    OPWORD    $A977
  162.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  163.         IMPORT_CFM_FUNCTION WaitMouseUp
  164.     ENDIF
  165.  
  166. ;
  167. ; pascal UInt32 TickCount(void )
  168. ;
  169.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  170.         _TickCount:    OPWORD    $A975
  171.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  172.         IMPORT_CFM_FUNCTION TickCount
  173.     ENDIF
  174.  
  175. ;
  176. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  177. ;
  178.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  179.         _KeyTranslate:    OPWORD    $A9C3
  180.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  181.         IMPORT_CFM_FUNCTION KeyTranslate
  182.     ENDIF
  183.  
  184. ;
  185. ; pascal UInt32 GetCaretTime(void)
  186. ;
  187.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  188.         Macro
  189.         _GetCaretTime         &dest=(sp)
  190.             move.l            $02F4,&dest
  191.         EndM
  192.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  193.         IMPORT_CFM_FUNCTION GetCaretTime
  194.     ENDIF
  195.  
  196.  
  197. KeyMap                    RECORD 0
  198. map                         ds.b    16                ; offset: $0 (0)
  199. sizeof                     EQU *                    ; size:   $10 (16)
  200.                         ENDR
  201. ;
  202. ; pascal void GetKeys(KeyMap theKeys)
  203. ;
  204.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  205.         _GetKeys:    OPWORD    $A976
  206.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  207.         IMPORT_CFM_FUNCTION GetKeys
  208.     ENDIF
  209.  
  210.  
  211.  
  212. ;  Obsolete event types & masks 
  213.  
  214. networkEvt                        EQU        10
  215. driverEvt                        EQU        11
  216. app1Evt                            EQU        12
  217. app2Evt                            EQU        13
  218. app3Evt                            EQU        14
  219. app4Evt                            EQU        15
  220. networkMask                        EQU        $0400
  221. driverMask                        EQU        $0800
  222. app1Mask                        EQU        $1000
  223. app2Mask                        EQU        $2000
  224. app3Mask                        EQU        $4000
  225. app4Mask                        EQU        $8000
  226. EvQEl                    RECORD 0
  227. qLink                     ds.l    1                ; offset: $0 (0)
  228. qType                     ds.w    1                ; offset: $4 (4)
  229. evtQWhat                 ds.w    1                ; offset: $6 (6)        ;  this part is identical to the EventRecord as defined above 
  230. evtQMessage                 ds.l    1                ; offset: $8 (8)
  231. evtQWhen                 ds.l    1                ; offset: $C (12)
  232. evtQWhere                 ds        Point            ; offset: $10 (16)
  233. evtQModifiers             ds.w    1                ; offset: $14 (20)
  234. sizeof                     EQU *                    ; size:   $16 (22)
  235.                         ENDR
  236. ; typedef struct EvQEl *                EvQElPtr
  237.  
  238. ; typedef GetNextEventFilterUPP         GNEFilterUPP
  239.  
  240. ;
  241. ; pascal QHdrPtr GetEvQHdr(void )
  242. ;
  243.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  244.         Macro
  245.         _GetEvQHdr            &dest=(sp)
  246.             move.l            #$0000014A,&dest
  247.         EndM
  248.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  249.         IMPORT_CFM_FUNCTION GetEvQHdr
  250.     ENDIF
  251.  
  252. ;
  253. ; pascal UInt32 GetDblTime(void)
  254. ;
  255.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  256.         Macro
  257.         _GetDblTime           &dest=(sp)
  258.             move.l            $02F0,&dest
  259.         EndM
  260.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  261.         IMPORT_CFM_FUNCTION GetDblTime
  262.     ENDIF
  263.  
  264. ;
  265. ; pascal void SetEventMask(EventMask value)
  266. ;
  267.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  268.         Macro
  269.         _SetEventMask         &src=(sp)+
  270.             move.w            &src,$0144
  271.         EndM
  272.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  273.         IMPORT_CFM_FUNCTION SetEventMask
  274.     ENDIF
  275.  
  276. ;
  277. ; pascal OSErr PPostEvent(EventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  278. ;
  279.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  280.         _PPostEvent:    OPWORD    $A12F
  281.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  282.         IMPORT_CFM_FUNCTION PPostEvent
  283.     ENDIF
  284.  
  285. ;
  286. ; pascal Boolean GetNextEvent(EventMask eventMask, EventRecord *theEvent)
  287. ;
  288.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  289.         _GetNextEvent:    OPWORD    $A970
  290.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  291.         IMPORT_CFM_FUNCTION GetNextEvent
  292.     ENDIF
  293.  
  294. ;
  295. ; pascal Boolean WaitNextEvent(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  296. ;
  297.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  298.         _WaitNextEvent:    OPWORD    $A860
  299.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  300.         IMPORT_CFM_FUNCTION WaitNextEvent
  301.     ENDIF
  302.  
  303. ;
  304. ; pascal Boolean EventAvail(EventMask eventMask, EventRecord *theEvent)
  305. ;
  306.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  307.         _EventAvail:    OPWORD    $A971
  308.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  309.         IMPORT_CFM_FUNCTION EventAvail
  310.     ENDIF
  311.  
  312.  
  313. ;
  314. ; pascal OSErr PostEvent(EventKind eventNum, UInt32 eventMsg)
  315. ;
  316.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  317.         ; parameters:
  318.         ;    eventNum        => A0
  319.         ;    eventMsg        => D0
  320.         ; returns:
  321.         ;    OSErr           <= D0
  322.         _PostEvent:    OPWORD    $A02F
  323.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  324.         IMPORT_CFM_FUNCTION PostEvent
  325.     ENDIF
  326.  
  327. ;
  328. ; pascal Boolean OSEventAvail(EventMask mask, EventRecord *theEvent)
  329. ;
  330.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  331.         _OSEventAvail:    OPWORD    $A030
  332.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  333.         IMPORT_CFM_FUNCTION OSEventAvail
  334.     ENDIF
  335.  
  336. ;
  337. ; pascal Boolean GetOSEvent(EventMask mask, EventRecord *theEvent)
  338. ;
  339.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  340.         _GetOSEvent:    OPWORD    $A031
  341.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  342.         IMPORT_CFM_FUNCTION GetOSEvent
  343.     ENDIF
  344.  
  345. ;
  346. ; pascal void FlushEvents(EventMask whichMask, EventMask stopMask)
  347. ;
  348.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  349.         _FlushEvents:    OPWORD    $A032
  350.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  351.         IMPORT_CFM_FUNCTION FlushEvents
  352.     ENDIF
  353.  
  354. ;
  355. ; pascal void SystemClick(const EventRecord *theEvent, WindowPtr theWindow)
  356. ;
  357.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  358.         _SystemClick:    OPWORD    $A9B3
  359.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  360.         IMPORT_CFM_FUNCTION SystemClick
  361.     ENDIF
  362.  
  363. ;
  364. ; pascal void SystemTask(void )
  365. ;
  366.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  367.         _SystemTask:    OPWORD    $A9B4
  368.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  369.         IMPORT_CFM_FUNCTION SystemTask
  370.     ENDIF
  371.  
  372. ;
  373. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  374. ;
  375.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  376.         _SystemEvent:    OPWORD    $A9B2
  377.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  378.         IMPORT_CFM_FUNCTION SystemEvent
  379.     ENDIF
  380.  
  381.  
  382.  
  383.     ENDIF ; __EVENTS__ 
  384.  
  385.